<template>
  <div>
    <basicContainer>
      <avue-crud
        ref="crud"
        :data="tableData"
        :page="page"
        :option="tableOption"
        v-model="form"
        @size-change="sizeChange"
        @current-change="currentChange"
        @on-load="getList"
      >
        <!-- 自定义新增弹窗 -->
        <template slot-scope="scope" slot="menuLeft">
          <el-button
            type="primary"
            icon="el-icon-plus"
            size="small"
            @click.stop="handleAdd(scope.row)"
            >新增</el-button
          >
        </template>

        <!-- 操作 -->
        <template slot-scope="scope" slot="menu">
          <el-button
            type="text"
            calss="el-text-edit"
            size="small"
            plain
            @click.stop="handleEdit(scope.row, scope.index)"
            >编辑</el-button
          >
        </template>
      </avue-crud>
    </basicContainer>
  </div>
</template>

<script>
import { tableOption } from "@/crud/home";
export default {
  data() {
    return {
      tableOption: tableOption,
      tableData: [],
      form: {},
      page: {
        total: 10,
        currentPage: 1,
        pageSize: 20,
      },
    };
  },
  mounted() {},
  methods: {
    getList() {
      this.tableData = [
        {
          id: 126,
          merchantNo: "00008",
          merchantName: "测试泛泰克",
          status: 1,
          exchangeRate: 100,
          settlementType: 1,
          startDate: "2021-07-04",
          endDate: "2021-07-31",
          mobile: "13288888888",
          contacts: "张岚",
        },
      ];
    },
    // 新增
    handleAdd() {
      this.$refs.crud.rowAdd();
    },
    // 编辑
    handleEdit(row, index) {
      this.$refs.crud.rowEdit(row, index);
    },
    sizeChange() {},
    currentChange() {},
  },
};
</script>

<style lang="less" scoped>
// /deep/ .avue-crud__menu{
//   display: none !important;
// }
</style>